package event

type eventCallback func(args ...interface{})

type eventEmitter struct {
	event map[string]eventCallback
}

func (this *eventEmitter) On(name string, callback eventCallback) {
	this.event[name] = callback
}

func (this *eventEmitter) Emit(name string, args ...interface{}) {
	this.event[name](args)
}

func EventEmitter() *eventEmitter {
	e := new(eventEmitter)
	e.event = make(map[string]eventCallback)
	return e
}

func (this *eventEmitter) Remove(name string) {
	delete(this.event, name)
}
